package com.home.andromotic.model;

import com.home.andromotic.R;

public class IOIODevice {

	public IOIODevice(int tipo, int in_out, int valores, int min_val,
			int max_val, int state, int id, int zone, String nombre) {
		super();
		this.categoria = tipo;
		this.tipo = in_out;
		this.valores = valores;
		this.min_val = min_val;
		this.max_val = max_val;
		this.state = state;
		this.nombre = nombre;
		this.id = id;
		this.zone = zone;

	}

	private int iluminacion_on = R.drawable.ligth_on;
	private int iluminacion_off = R.drawable.ligth_off;
	
	private int energia_on = R.drawable.power_on;
	private int energia_off = R.drawable.power_off;

	private int categoria;
	private int tipo;
	private int valores;
	private int min_val;
	private int max_val;
	private int state;
	private int id;
	private int zone;
	private String nombre;

	public int getCategoria() {
		return categoria;
	}

	public void setCategoria(int categoria) {
		this.categoria = categoria;
	}

	public int getTipo() {
		return tipo;
	}

	public void setTipo(int tipo) {
		this.tipo = tipo;
	}

	public int getValores() {
		return valores;
	}

	public void setValores(int valores) {
		this.valores = valores;
	}

	public int getMin_val() {
		return min_val;
	}

	public void setMin_val(int min_val) {
		this.min_val = min_val;
	}

	public int getMax_val() {
		return max_val;
	}

	public void setMax_val(int max_val) {
		this.max_val = max_val;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public String getNombre() {
		return nombre;
	}

	public void setNombre(String nombre) {
		this.nombre = nombre;
	}

	public void changeState() {
		if (valores == 3) {
			if (state == 0) {
				state = 1;
			} else {
				state = 0;
			}
		}
	}

	public int getId() {
		return id;
	}

	public int getZone() {
		return zone;
	}

	public int getIcon() {
		if (categoria == 1) {
			if (state == 1) {
				return iluminacion_on;
			}
			if (state == 0) {
				return iluminacion_off;
			}
		}
		
		if (categoria == 2) {
			if (state == 1) {
				return energia_on;
			}
			if (state == 0) {
				return energia_off;
			}
		}
		return iluminacion_off;
	}

}
